package com.zll.dmsboot.controller;


import com.zll.dmsboot.entity.User;
import com.zll.dmsboot.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Zhanglinlu
 * @since 2020-07-04
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("add")
    public Object addone() {
        User user = new User();
        user.setUsername("zll");
        user.setPassword("zll");
        user.setEmail("zll@163.com");
        if (userService.save(user)) {
            return "success";
        }
        return "error";

    }

    @DeleteMapping("logic")
    public Object remove() {
        return userService.removeById(1279626895841972225L);

    }


}
